package cn.com.guage.springframework.beans.factory.support;

import java.util.HashMap;
import java.util.Map;

import cn.com.guage.springframework.beans.BeansException;
import cn.com.guage.springframework.beans.factory.config.BeanDefinition;

/**
 */
public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory implements BeanDefinitionRegistry {

	  private Map<String, BeanDefinition> beanDefinitionMap = new HashMap<>();

	    @Override
	    public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) {
	        beanDefinitionMap.put(beanName, beanDefinition);
	    }

	    @Override
	    public BeanDefinition getBeanDefinition(String beanName) throws BeansException {
	        BeanDefinition beanDefinition = beanDefinitionMap.get(beanName);
	        if (beanDefinition == null) throw new BeansException("No bean named '" + beanName + "' is defined");
	        return beanDefinition;
	    }
  

}
